package com.wn.androidflutterinnerwndemo

import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity


/**
 * Author : wn
 * Email : maoning20080808@163.com
 * Date : 2025/7/19 8:54
 * Description :
 * 参考：https://juejin.cn/post/7323142671761276969
 * 上传下载资源：https://download.csdn.net/download/maoning20080808/91409483
 */
class MainActivity : AppCompatActivity() , View.OnClickListener{

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_main)

        findViewById<Button>(R.id.main_with_engine).setOnClickListener(this)
        findViewById<Button>(R.id.main_mutual_comm).setOnClickListener(this)
    }

    override fun onClick(v: View?) {
        v?:return
        when(v.id){
            R.id.main_with_engine -> {
                myStartActivity(WithEngineActivity::class.java)
            }
            R.id.main_mutual_comm -> {
                myStartActivity(MutualCommunicationActivity::class.java)
            }
        }
    }

    private fun <T> myStartActivity(clazz : Class<T>){
        val intent = Intent(this, clazz)
        startActivity(intent)
    }

}